
<div>
    <input type="file" id="upload[id]" name="upload[id]" />
    <input type="text" id="[id]" name="[id]" value="[value]" style="width:500px" />
    <div id="div[id]" style=" margin:10px 0px;">
    <a href="__ROOT__[value]" id="a[id]" target="_blank">__ROOT__[value]</a>&nbsp;<a href="#" onclick="delfile('[id]')">删除</a>
    </div>
</div>
<script type="text/javascript">
	var value = "[value]";
		if(value == "")
		{
			$("#div[id]").hide();
		}
		$('#upload[id]').uploadify({
			'swf': '__PUBLIC__/common/uploadify/uploadify.swf")',
			'uploader': "{:U('Fwadmin/Login/uploadFile')}?path=[path]&sessionid={:session_id()}",
			'cancelImg': '__PUBLIC__/common/uploadify/uploadify-cancel.png',
			'buttonText':'选择文件',
			'auto'     : true,
			'height': 24,
			'width': 80,
                        'multi': false,
			'fileTypeDesc': '文件',
			'fileTypeExts':'*.rar;*.zip;*.doc;*.xls;*.ppt;*.docx;*.xlsx;*.pptx;*.pdf;*.jpg;*.gif;*.png;*.bmp;*.txt;',
			'fileSizeLimit':'2024KB',
			'removeTimeout':0,
			'onUploadError': function (file, errorCode, errorMsg, errorString, swfuploadifyQueue) {
				if(errorCode !== "-280"&&errorMsg !== "File Upload Cancelled.")
				{
					alert(errorMsg);
				}
			},
			'onCancel':function(event,queueID,file,data){
			   //  alert("取消成功！");
			},
			'onUploadSuccess': function (file, data, response) {
				if (response == true) {
					//alert(data);
					$("#div[id]").show();
					var json=eval('('+data+')');
					$("#[id]").val(json.SaveName);
					$("#a[id]").attr("href",'__ROOT__'+json.SaveName);
					$("#a[id]").html('__ROOT__'+json.SaveName);
				}
				else {
					alert("上传出错！");
				}
			}
		});
</script>